package com.zero.business.order.feign;

import com.zero.business.order.feign.sentinel.OrderMemberFeignSentinel;
import com.zero.domain.Member;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

/*
*   订单模块 远程调用 会员模块
* */

// value：远程调用的服务名称     fallback：降级方法所在类 的类对象
@FeignClient(value = "zero-business-member", fallback = OrderMemberFeignSentinel.class)
public interface OrderMemberFeign {

    String baseUrl = "/member/";

    /*
    *   远程调用 会员模块中的 selectByPrimaryKey 接口，根据 userId 获取会员数据
    * */
    @GetMapping(baseUrl + "selectByPrimaryKey")
    public Member selectByPrimaryKey(@RequestParam("userId") Integer userId);


    /*
    *   远程调用 会员模块中的 updateByPrimaryKeySelective 接口，更改会员状态
    * */
    @PutMapping(baseUrl + "updateByPrimaryKeySelective")
    public void updateByPrimaryKeySelective(@RequestParam("userId") Integer userId, @RequestParam("status") String status, @RequestParam("money") BigDecimal money, @RequestParam("score") Integer score, @RequestParam("remark") String remark);




}
